package controller;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;

import boundary.IMenu;

public class RemoteController implements Runnable, IRemoteController {

	private IMenu menu;
	private PrintWriter out;
	private BufferedReader in;
	
	public RemoteController(IMenu menu, BufferedReader in, PrintWriter out){
		this.menu = menu;
		this.in = in;
		this.out = out;
	}
	
	@Override
	public void run() {
		
		 String inputLine, outputLine;
		 System.out.println("Forbindelse oprettet");
         out.println("Forbindelse oprettet");

         try {
			while ((inputLine = in.readLine()) != null) {
			     outputLine = "Kommando modtaget.";
			     System.out.println("Kommando modtaget: " + inputLine);
			     out.println(outputLine);
			     if (inputLine.equals("Exit"))
			         break;
			 }
		} catch (IOException e) {
			System.out.println("Forbindelse tabt.");
			e.printStackTrace();
		}
		
	}
	

}
